import { notification } from 'ant-design-vue';

// tslint:disable-next-line:class-name
interface noticeConfig {
    message: string;
    description?: string;
    onClick?: () => void;
    onClose?: () => void;
    duration?: number;
}

const duration: number = 4;

notification.config({
    placement: 'bottomRight',
    bottom: '50px',
});

export function successNotice(config: noticeConfig) {
    notification.success({
        message: config.message,
        description: config.description || null,
        onClick: config.onClick || null,
        duration: config.duration || duration,
        onClose: config.onClose || null,
    });
}

export function errorNotice(config: noticeConfig) {
    notification.error({
        message: config.message,
        description: config.description || null,
        onClick: config.onClick || null,
        duration: config.duration || duration,
        onClose: config.onClose || null,
    });
}

export function infoNotice(config: noticeConfig) {
    notification.info({
        message: config.message,
        description: config.description || null,
        onClick: config.onClick || null,
        duration: config.duration || duration,
        onClose: config.onClose || null,
    });
}

export function warningNotice(config: noticeConfig) {
    notification.warning({
        message: config.message,
        description: config.description || null,
        onClick: config.onClick || null,
        duration: config.duration || duration,
        onClose: config.onClose || null,
    });
}

export function openNotice(config: noticeConfig) {
    notification.open({
        message: config.message,
        description: config.description || null,
        onClick: config.onClick || null,
        duration: config.duration || duration,
        onClose: config.onClose || null,
    });
}



